package com.cjkj.system.api;

import com.cjkj.common.core.constant.SecurityConstants;
import com.cjkj.common.core.constant.ServiceNameConstants;
import com.cjkj.common.core.domain.R;
import com.cjkj.system.api.domain.THospitalUserLoginLog;
import com.cjkj.system.api.domain.THospitalUserOperLog;
import com.cjkj.system.api.factory.RemoteLogFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 日志服务
 */
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService
{
    /**
     * 保存系统日志
     *
     * @param THospitalUserOperLog 日志实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/operlog")
    R<Boolean> saveLog(@RequestBody THospitalUserOperLog THospitalUserOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;

    /**
     * 保存访问记录
     *
     * @param THospitalUserLoginLog 访问实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logininfor")
    R<Boolean> saveLogininfor(@RequestBody THospitalUserLoginLog THospitalUserLoginLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
